package org.fireflow2.designer.eclipse.palette;

import org.eclipse.gef.requests.CreationFactory;
import org.fireflow.pdl.fpdl20.diagram.Fpdl20DiagramElement;


public class DiagramElementFactory implements CreationFactory {

	Fpdl20DiagramElement elementType = null;
	DiagramElementSubType childType = null;
	public DiagramElementFactory(Fpdl20DiagramElement arg0,DiagramElementSubType arg1){
		this.elementType = arg0 ;
		this.childType = arg1;
	}
	public Object getNewObject() {
		return elementType;
		
//		ModelElement newElement = null;
//		if (START_NODE.equals(elementType)){
//			newElement = new StartNodeImpl();
//			newElement.setName("START_NODE");
//		}else if (END_NODE.equals(elementType)){
//			newElement = new EndNodeImpl();
//		}else if (SYNCHRONIZER.equals(elementType)){
//			newElement = new RouterImpl();
//		}else if (ACTIVITY.equals(elementType)){
//			newElement = new ActivityImpl();
//			if (childType!=null){
//				Task task = null;
//
//				if (FORM.equals(childType)){
//					task = new FormTask((Activity)newElement,"Task1");
//				}else if (TOOL.equals(childType)){
//					task = new ToolTask((Activity)newElement,"Task1");
//				}else if (SUBFLOW.equals(childType)){
//					task = new SubflowTask((Activity)newElement,"Task1");
//				}
//				if (task!=null){
//					task.setSn(UUID.randomUUID().toString());
//					((Activity)newElement).getInlineTasks().add(task);
//				}
//			}
//		}
//		else if (TRANSITION.equals(elementType)){
//			newElement = new TransitionImpl();
//		}
//		else if (LOOP.equals(elementType)){
//			newElement = new Loop();
//		}
		
//		return newElement;
	}

	public Object getObjectType() {
		return childType;
	}

}
